<?php
/* @var $this UserController */
/* @var $model User */

$this->breadcrumbs=array(
	Yii::t('app', 'Message')=>array('index'),
	Yii::t('app', 'Bulletin Board Search'),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-form form').submit(function(){
	$('#post-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div class="page-header">
	<div class="page-title"><h3><?php echo Yii::t('app', 'Bulletin Board Search' ) ?></h3></div>
</div>

<h1></h1>

<div class="search-form">
<?php
$this->renderPartial('mng/_search',array(
	'model'=>$model,
)); 
?>
</div><!-- search-form -->

<?php $sum = $model->getSearchSummaryMng() ?>
<table class="table table-striped table-condensed table-nobor" id="tabSum">
	<tr>
		<td><?php echo Yii::t('app', 'User' ) ?>:</td>
		<td><?php echo $sum['user'] ?></td>
	</tr>
	<tr>
		<td><?php echo Yii::t('app', 'Operator' ) ?>:</td>
		<td><?php echo $sum['opr'] ?></td>
	</tr>
</table>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'post-grid',
	'dataProvider'=>$model->mngSearch(),
	'columns'=>array(
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view_user}',
			'buttons'=>array(
				'view_user' => array(
					'label'=>Yii::t('app', 'View Detail'),
					'url'=>'Yii::app()->createAbsoluteUrl("admin/user/update", array("id"=>$data->user->id))',
					'options'=>array('class'=>'btn btn-info'),
				)
			),
			'headerHtmlOptions'=>array('class'=>'span2'),
		),
		array(
			'header' => Yii::t('app', 'Nickname'),
			'value' => '$data->user->nickname',
		),
		array(
			'header' => Yii::t('app', 'Profile ID'),
			'value' => '$data->user->profile_id',
		),
		'created_time:time',
		'content',
		// actions
		array(
			// 'header'=>Yii::t('app', 'Actions'),
			'class'=>'CButtonColumn',
			'template'=>'{delete}',
			'deleteButtonImageUrl'=>false,
			'deleteButtonOptions'=>array('class'=>'btn btn-danger'),
			'deleteButtonLabel'=>Yii::t('app', 'Delete'),
			// 'headerHtmlOptions'=>array('class'=>'span4'),
		),
	),
	'itemsCssClass'=>'table table-bordered table-hover',
	'cssFile'=>false,
	'afterAjaxUpdate' => 'updateSummary',
)); ?>

<script>
function updateSummary(id,data) {
	$('#tabSum').html($(data).find('#tabSum').html());
}
</script>